package io.github.frailty9.crserver.config

import org.mindrot.jbcrypt.BCrypt
import org.noear.solon.annotation.Component
import org.noear.solon.annotation.Init
import org.noear.solon.annotation.Inject

/**
 * CR-Server 应用全局配置
 */
@Component
class CrGlobalConfig() {

    @Inject("\${rc.global.default-pwd}")
    private var defaultPassword: String = "123456"

    private lateinit var defaultHashedPwd: String

    @Init
    @Suppress("unused")
    fun init() {
        this.defaultHashedPwd = BCrypt.hashpw(defaultPassword, BCrypt.gensalt())
    }

    fun getDefaultHashedPwd(): String {
        return defaultHashedPwd
    }
}
